create table if not exists jms_dm.dm_order_taking_delivery_summary_dt(
    input_date                date         comment '录入日期'
    ,network_code             varchar(255) comment '网点CODE'
    ,network_name             varchar(255) comment '网点名称'
    ,agent_code               varchar(255) comment '代理区CODE'
    ,agent_name               varchar(255) comment '代理区名称'
    ,center_code              varchar(255) comment '交件转运中心CODE'
    ,center_name              varchar(255) comment '交件转运中心名称'
    ,zone_code                varchar(255) comment '片区CODE'
    ,zone_name                varchar(255) comment '片区名称'
    ,area_code                varchar(255) comment '底层片区CODE'
    ,area_name                varchar(255) comment '底层片区名称'
    ,order_qty                bigint       comment '订单量'
    ,taking_qty               bigint       comment '揽收量'
    ,not_taking_qty           bigint       comment '未揽收量'
    ,delivery_qty             bigint       comment '交件量'
    ,not_delivery_qty         bigint       comment '未交件量'
) ENGINE=OLAP
DUPLICATE KEY(
    input_date ,network_code, network_name
)
COMMENT "经营指标-订单揽收交件汇总"
PARTITION BY RANGE(`input_date`)(
START ('2023-07-01') END ('2023-07-30') EVERY (INTERVAL 1 day)
)
DISTRIBUTED BY HASH(network_code, network_name) BUCKETS 5
PROPERTIES (
    "replication_num" = "3",
    "dynamic_partition.enable" = "true",
    "dynamic_partition.time_unit" = "DAY",
    "dynamic_partition.time_zone" = "Asia/Shanghai",
    "dynamic_partition.start" = "-93",
    "dynamic_partition.end" = "3",
    "dynamic_partition.prefix" = "p",
    "dynamic_partition.buckets" = "5",
    "in_memory" = "false",
    "storage_format" = "V2"
);
